load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbcode_macros//build_defs:thrift_library.bzl", "thrift_library")

oncall("fboss_agent_push")

thrift_library(
    name = "test",
    languages = [
        "cpp2",
    ],
    no_plugin_deps = ["//thrift/annotation:all"],
    thrift_cpp2_options = "json,reflection",
    thrift_srcs = {"test.thrift": []},
    deps = [
        "//fboss/agent:switch_config",
        "//thrift/annotation:cpp",
        "//thrift/annotation:thrift",
    ],
)

cpp_unittest(
    name = "thrift_hybrid_node_tests",
    srcs = [
        "ThriftHybridStructNodeTests.cpp",
    ],
    preprocessor_flags = ["-DENABLE_DYNAMIC_APIS"],
    supports_static_listing = False,
    deps = [
        ":test-cpp2-reflection",
        "//fboss/thrift_cow/nodes:nodes",
        "//fboss/thrift_cow/nodes:serializer",
        "//thrift/lib/cpp2/folly_dynamic:folly_dynamic",
        "//thrift/lib/cpp2/protocol:protocol",
        "//thrift/lib/cpp2/reflection:reflection",
        "//thrift/lib/cpp2/reflection:testing",
    ],
)

cpp_unittest(
    name = "thrift_node_tests",
    srcs = [
        "ThriftHybridStructNodeTests.cpp",
        "ThriftListNodeTests.cpp",
        "ThriftMapNodeTests.cpp",
        "ThriftSetNodeTests.cpp",
        "ThriftStructNodeResolverTests.cpp",
        "ThriftStructNodeTests.cpp",
        "ThriftUnionNodeTests.cpp",
    ],
    preprocessor_flags = ["-DENABLE_DYNAMIC_APIS"],
    supports_static_listing = False,
    deps = [
        ":test-cpp2-reflection",
        "//fboss/agent/state:nodebase",
        "//fboss/fsdb/if:fsdb_oper-cpp2-types",
        "//fboss/thrift_cow/nodes:nodes",
        "//fboss/thrift_cow/nodes:serializer",
        "//fboss/thrift_cow/visitors/tests:visitor_test_utils",
        "//thrift/lib/cpp2/folly_dynamic:folly_dynamic",
        "//thrift/lib/cpp2/protocol:protocol",
        "//thrift/lib/cpp2/reflection:reflection",
        "//thrift/lib/cpp2/reflection:testing",
    ],
)
